<?php

abstract class Kzend_Controller_Action_Abstract extends Zend_Controller_Action
{
    protected $_logger = null;
    protected $_messageManager = null;

    public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
    {
        parent::__construct($request, $response, $invokeArgs);

        $this->_logger = Zend_Registry::get("Kzend_Logger");
        $this->_messageManager = Zend_Registry::get("Kzend_MessageManager");
    }

    public function init()
    {
        parent::init();
    }

    public function postDispatch()
    {
        parent::postDispatch();

        $appBase = "/";
        $configs = Zend_Registry::get("appConfig");
        if (isset($configs['kzend']['viewAssign'])) {
            $viewAssign = $configs['kzend']['viewAssign'];
            foreach ($viewAssign as $key => $var) {
                $this->view->assign($key, $var);
            }
        }
    }

    public function getLogger()
    {
        return $this->_logger;
    }

    public function getMessage($msgId)
    {
        return $this->_messageManager->get($msgId);
    }

    public function getMessageManager()
    {
        return $this->_messageManager;
    }
}
